package com.pro.control;/*
    ClassName:censusController
    Package:com.pro.control
    Description: 统计
    @Date:2021/12/16 11:26
    @Author: 赵自强
*/

import com.pro.entity.Census;
import com.pro.entity.JsonData;
import com.pro.service.CensusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/census")
public class CensusController {

    @Autowired
    private CensusService censusService;

    //获取商品订单数  赵自强  21/12/16 getCommodityOrderNum
    @RequestMapping("/getCommodityOrderNum")
    public JsonData getCommodityOrderNum(){
        List<Census> orderNum = censusService.getOrderNum();
        JsonData jsonData = new JsonData();
        return orderNum!=null?jsonData.buildSuccess(orderNum):JsonData.buildError("后台数据错误");
    }

    //获取课程订单数  赵自强  21/12/16 getCourseOrderNum
    @RequestMapping("/getCourseOrderNum")
    public JsonData getCourseOrderNum(){
        List<Census> orderNum = censusService.getCourseOrderNum();
        JsonData jsonData = new JsonData();
        return orderNum!=null?jsonData.buildSuccess(orderNum):JsonData.buildError("后台数据错误");
    }

    //获取商品评论 赵自强 21/12/16 getCommodityCommentNum getCourseCommentNum getArticleCommentNum
    @RequestMapping("/getCommodityCommentNum")
    public JsonData getCommodityCommentNum(){
        List<Census> commodityCommentNum = censusService.getCommodityCommentNum();
        JsonData jsonData = new JsonData();
        return commodityCommentNum!=null?jsonData.buildSuccess(commodityCommentNum):JsonData.buildError("后台数据错误");
    }

    //获取课程评论 赵自强 21/12/16 getCourseCommentNum
    @RequestMapping("/getCourseCommentNum")
    public JsonData getCourseCommentNum(){
        List<Census> courseCommentNum = censusService.getCourseCommentNum();
        JsonData jsonData = new JsonData();
        return courseCommentNum!=null?jsonData.buildSuccess(courseCommentNum):JsonData.buildError("后台数据错误");
    }

    //获取微圈评论 赵自强 21/12/16 getArticleCommentNum
    @RequestMapping("/getArticleCommentNum")
    public JsonData getArticleCommentNum(){
        List<Census> articleCommentNum = censusService.getArticleCommentNum();
        JsonData jsonData = new JsonData();
        return articleCommentNum!=null?jsonData.buildSuccess(articleCommentNum):JsonData.buildError("后台数据错误");
    }

}
